#ifndef FEEDMODEL_H
#define FEEDMODEL_H

#include <QStandardItemModel>
#include <QSettings>
#include "feeditem.h"


class FeedModel : public QStandardItemModel
{
    Q_OBJECT

public:
    //Constructor
    FeedModel(QSettings* settings);

    //Save and restore the model
    void save();
    void restore();

public slots:
    //Add a feed to the model
    void addFeed(const QUrl& feedUrl);

    //Process an item (when double-clicked in the view : default processing)
    void defaultProcessItem(const QModelIndex& index);

private:
    //Application settings
    QSettings*  _settings;

    //Find a feed item by its name
    FeedItem* findFeedItem(const QString& feedName );
};

#endif // FEEDMODEL_H
